<template>
  <view>
	<cu-custom bgColor="bg-white" :isMyBack="true">
		<block slot="backText">
			<view class="cu-avatar" :style="[{ backgroundImage:'url(' + fileUrl + indexData.wx_logo + ')' }]"></view>
			<text class="text-lg text-bold margin-left-sm">{{ indexData.wx_name }}</text>
		</block>
	</cu-custom>
	<view>
		<view class="cu-bar search bg-white padding-bottom">
			<view class="search-form round">
				<text class="cuIcon-search text-df"></text>
				<input @focus="InputFocus" @blur="InputBlur" :adjust-position="false" type="text" placeholder="请输入搜索内容" confirm-type="search"></input>
			</view>
		</view>
		<swiper class="screen-swiper square-dot margin radius" :indicator-dots="true" :autoplay="true" :circular="true" interval="5000" duration="500">
			<swiper-item v-for="(item,index) in indexData.swiperList" :key="index">
				<image :src="fileUrl + item.image" mode="aspectFill" ></image>
			</swiper-item>
		</swiper>

		<view class="cu-list grid col-4 no-border tabbar-list bg-white">
			<view class="cu-item" v-for="(item, index) in indexData.tabList" :key="index">
				<view class="cu-avatar" :style="[{ backgroundImage:'url(' + fileUrl + item.image + ')' }]"></view>
				<text :class="'padding-t-' + item.title.length">{{item.title}}</text>
			</view>
		</view>

		<view class="padding bg-white margin-top">
			<view class="flex notice-tab align-center">
				<view class="notice-title">
					通知公告
				</view>
				<view class="flex-sub">
					<swiper class="swiper-list" vertical="true" autoplay="true" circular="true" interval="3000">
						<swiper-item v-for="(item, index) in indexData.noticeList" :key="index" >
							<text class="notice-content">{{item.title}}</text>
						</swiper-item>
					</swiper>
				</view>
				<view class="notice-icon lg text-gray cuIcon-right"></view>
			</view>
		</view>
		<view class="bg-white padding-bottom">
			<view class="cu-bar margin-top">
				<view class="action text-bold">
					<text class="text-xl text-bold text-black">热点政策</text>
				</view>
				<view class="action text-b8">
					更多政策<text class="lg text-gray cuIcon-right"></text>
				</view>
			</view>
			<view class="zc-item-list">
				<view class="cu-item" v-for="(item, index) in indexData.recentPolicyList" :key="index">
					<view class="content">{{item.title}}</view>
					<view class="action flex justify-between">
						<view class="text-gray flex">浏览量:{{ item.click }}</view>
						<view class="text-gray">{{ item.create_time }}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
  </view>
</template>
<script>
import Vue from 'vue'
import { VUE_APP_NGINX_HTTPS_URL } from '@/config'
import { isDefine } from '@/utils/index'
import { fetchIndexData } from "@/api/index"
export default {
  components: {},
  data() {
    return {
		fileUrl: VUE_APP_NGINX_HTTPS_URL,
		windowHeight: this.windowHeight,
		windowWidth: this.windowWidth,
		statusBar: this.StatusBar,
		customBar: this.CustomBar,
		userInfo: uni.getStorageSync('userInfo'),
		status: 'loading', // loading noMore  more
		indexData: {
			recentPolicyList: [],
			noticeList: [],
			tabList: [],
			swiperList: [],
			wx_name: '南沙惠企政策通',
			wx_logo: '',
		},
	}
  },
  onShow() {

  },
  onLoad(e) {
    this.loadData()
  },
  methods: {
    loadData() {
		fetchIndexData().then(({ data }) => {
			this.indexData = data;
		}).catch(err => {});


	}
  }

}
</script>
